//using LitJson;
using HyxFrame.Core;
using UnityEngine;

/*
* Introduction：
* Creator：
*/

[DisallowMultipleComponent]
public class BaseComponent : MonoSingleton<BaseComponent>
{

    private bool m_GamePaused = false;
    private bool m_RunInBackground = false;
    private bool m_NeverSleep = false;


    private float m_GameSpeed = 1;
    private int m_GameFrameRate;

    private bool m_compFinish = false;



    /// <summary>
    /// 游戏是否暂停。
    /// </summary>
    public bool GamePaused
    {
        get
        {
            return m_GameSpeed <= 0f; ;
        }
        set
        {
            m_GamePaused = value;
            GameSpeed = 0;
        }
    }

    /// <summary>
    /// 游戏是否允许后台运行。
    /// </summary>
    /// <value></value>
    public bool RunInBackground
    {
        get
        {
            return m_RunInBackground;
        }
        set
        {
            m_RunInBackground = value;
        }
    }

    /// <summary>
    /// 是否禁止休眠。
    /// </summary>
    public bool NeverSleep
    {
        get
        {
            return m_NeverSleep;
        }
        set
        {
            m_NeverSleep = value;
            Screen.sleepTimeout = value ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting;
        }
    }

    /// <summary>
    /// 获取和设置游戏帧率。
    /// </summary>
    /// <value></value>
    public int GameFrameRate
    {
        get
        {
            return m_GameFrameRate;
        }
        set
        {
            Application.targetFrameRate = m_GameFrameRate = value;
        }
    }

    /// <summary>
    /// 获取或设置游戏速度。
    /// </summary>
    public float GameSpeed
    {
        get
        {
            return m_GameSpeed;
        }
        set
        {
            Time.timeScale = m_GameSpeed = value >= 0f ? value : 0f;
        }
    }

    /// <summary>
    /// 组件初始化完毕
    /// </summary>
    public bool ComFinish
    {
        get
        {
            return m_compFinish;
        }
        set
        {
            m_compFinish = value;
        }
    }



    protected override void InitManager()
    {

    }



}
